package model.algorithms;

public class State implements Comparable<State> {
	private String state;

	private double f;
	private double g;
	private State cameFromState;
	private IAction cameFromAction;
	
	public State() {
	}
	
	public State(String state) {
		setState(state);
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public double getF() {
		return f;
	}

	public void setF(double f) {
		this.f = f;
	}

	public double getG() {
		return g;
	}

	public void setG(double g) {
		this.g = g;
	}
	
	public int compareTo(State state) {
		return (int)(f - state.f);
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof State)) {
			return false;
		}
		
		State other = (State)obj;
		return state.equals(other.state);
	}

	@Override
	public int hashCode() {
		return state.hashCode();
	}

	@Override
	public String toString() {
		return state;
	}
	
	public State getCameFromState() {
		return cameFromState;
	}
	
	public void setCameFromState(State cameFromState) {
		this.cameFromState = cameFromState;
	}

	public IAction getCameFromAction() {
		return cameFromAction;
	}

	public void setCameFromAction(IAction cameFromAction) {
		this.cameFromAction = cameFromAction;
	}

}
